package edu.java.homework.hw10.tests;

//5.20
public class MyClass4 {
    static void f() throws InterruptedException {
	throw new InterruptedException("Time to go home");
	// InterruptedException å äèðåêòåí íàñëåäíèê íà Exception
    }

    public static void main(String[] args) throws InterruptedException {
	try {
	    f();
	    System.out.println(1);
	} finally {
	    System.out.println(2);
	}
	System.out.println(3);
    }
}

/*
 * Êàêâî ùå ñå îòïå÷àòà ïðè èçïúëíåíèå íà ïðîãðàìàòà (è çàùî)?
 */

// Answer:  2
// The program will finish with throwing of exception.
// f() throws an Exception in the try-block. So the next statement where we print 1 will not execute. Only finally-block
// will be executed and print 2. The statements after finally won't execute.
